using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

namespace DD.Data.SQL
{
    public static class PageManager
    {
        public static void AddUpdatePageAction(int aid, string control)
        {
            SqlConnection conn = new SqlConnection();
            conn = DD.Data.SQL.DataManager.GetConnection();

            SqlCommand com = new SqlCommand("sp_DD_ADD_UPDATE_ACTION_CONTROLS", conn);
            com.CommandType = CommandType.StoredProcedure;

            SqlParameter param1 = new SqlParameter("@AID", aid);
            param1.SqlDbType = SqlDbType.Int;


            SqlParameter param3 = new SqlParameter("@CONTROL", control);
            param3.SqlDbType = SqlDbType.NVarChar;

            com.Parameters.Add(param1);
            com.Parameters.Add(param3);

            conn.Open();
            com.ExecuteNonQuery();
            conn.Close();
        }

        public static string GetActionControl(int aid)
       { 
            SqlConnection conn = new SqlConnection();
            conn = DD.Data.SQL.DataManager.GetConnection();

            SqlCommand com = new SqlCommand("sp_DD_GET_ACTION_CONTROLS", conn);
            com.CommandType = CommandType.StoredProcedure;

            SqlParameter param1 = new SqlParameter("@AID", aid);
            param1.SqlDbType = SqlDbType.Int;


            SqlParameter param3 = new SqlParameter("@CONTROL", SqlDbType.NVarChar);
            param3.Direction = ParameterDirection.Output;

            com.Parameters.Add(param1);
            com.Parameters.Add(param3);

            conn.Open();
            com.ExecuteNonQuery();
            conn.Close();
            return param3.Value.ToString();
        }
    }
}
